<?php

namespace Trois\MainServerRegister\Registers;

use EasySwoole\Component\Singleton;
use EasySwoole\Crontab\Exception\Exception;
use EasySwoole\EasySwoole\Crontab\Crontab;
use EasySwoole\EasySwoole\Swoole\EventRegister;
use Trois\Crontab\CheckMiniStatueCrontab;
use Trois\Crontab\SendMiniStatueCrontab;
use Trois\Crontab\WorkWechatDsfAccessTokenRefreshCrontab;
use Trois\Crontab\WorkWechatDsfReplayAgainMsgCrontab;
use Trois\Design\Observer\IObserver;

class CrontabRegister extends BaseRegister implements IObserver
{

    use Singleton;

    private array $crontabs;

    private function __construct(EventRegister $register)
    {

        $this->crontabs = [
            
        ];

        parent::__construct($register);

    }

    public function update()
    {
        foreach ($this->crontabs as $crontab) {
            try {
                Crontab::getInstance()->register($crontab);
            } catch (Exception $e) {
            }
        }
    }


}